class Animal {
    readonly name: string;
    constructor(name) {
        this.name = name;
    }
    run() {
        return `${this.name} is runing`
    }
}

const snake = new Animal('lily');
console.log(snake.run());

// 类继承
class Dog extends Animal {
    bark() {
        return `${this.name} is barking`
    }
}

const xiaobao = new Dog('xiaobao');
console.log(xiaobao.run());
console.log(xiaobao.bark());


class Cat extends Animal {
    // 静态属性
    static categories = ['animal']
    constructor(name) {
        super(name);
        console.log(this.name);
    }
    run() {
        return 'Meow, ' + super.run();
    }
}

const maomao = new Cat('maomao')
console.log(maomao.run());
// 静态属性和静态方法直接用类调用
console.log(Cat.categories);
